package logic.UIProxyBag.componentProxy
{
	import common.core.GEevnt;
	import common.manager.GUI;
	import common.manager.ObserverEvt;
	
	import common.core.UIService;
	import logic.control.ComponentMoveControl;
	import logic.def.Def;
	import logic.manager.UIProxy;
	import logic.ui.componentInfoMed.LabelInfoMed;

	public class LabelProxy extends UIService
	{
		public function LabelProxy()
		{
		}
		
		public override function destory():void
		{
			
		}
		
		public override function start(value:* = null):void
		{
			UIProxy.stopAll();
			
			var ui : LabelInfoMed = new LabelInfoMed;
			
			GUI.add(LabelInfoMed.NAME,ui);
			GUI.setAlgin(LabelInfoMed.NAME,GUI.ALIGN_RIGHT,GUI.ALIGN_TOP);
			GUI.setOffest(LabelInfoMed.NAME,Def.Offset_Label_X,Def.Offset_Label_Y);
			
			GUI.open(LabelInfoMed.NAME);
			
			ObserverEvt.addRec(Def.COMPONENTPROPERTYCHANGED,this,onTargeMove);
		}
		
		public override function stop():void
		{
			ObserverEvt.removeRec(Def.COMPONENTPROPERTYCHANGED,this,onTargeMove);
			
			GUI.remove(LabelInfoMed.NAME);
		}
		
		private function onTargeMove(evt : GEevnt) : void
		{
			(GUI.find(LabelInfoMed.NAME) as LabelInfoMed).setTargetData();
		}
	}
}